<?php
Class Webkul_Marketplacepartner_Model_Observer
{
	public function DeleteProduct($observer) { 
		//Mage::getModel('marketplacepartner/marketplacepartner_product')->load($observer->getProduct()->getId())->delete();
		$write = Mage::getSingleton('core/resource')->getConnection('core_write');
		
		$readresult=$write->query("select customerpartnerproductid from ".Mage::getConfig()->getTablePrefix()."marketplacepartner_entity_data where mageproductid='".$observer->getProduct()->getId()."'");
		$row = $readresult->fetch();
		Mage::getModel('marketplacepartner/marketplacepartner_product')->load($row['customerpartnerproductid'])->delete();
		
		
		
		$readresult=$write->query("DELETE FROM ".Mage::getConfig()->getTablePrefix()."marketplacepartner_entity_data WHERE mageproductid='".$observer->getProduct()->getId()."'");
	}
	public function afterPlaceOrder($observer) { 
		$lastOrderId=$observer->getOrderIds();
		$order = Mage::getModel('sales/order')->load($lastOrderId);
		Mage::getModel('marketplacepartner/Productsales')->getProductSalesCalculation($order);	
	}
}